<template>
  <div>
    <!-- 标题导航栏 -->
    <div>
      <van-nav-bar class="nav-bar-style" title="设置" left-arrow @click-left="onClickLeft">
        <template #title>
          <div class="nav-bar-title-style">设置</div>
        </template>
        <template #left>
          <van-icon size="30" name="arrow-left" color="#FFF" />
        </template>
      </van-nav-bar>
    </div>
    <div class="setting-info-style">
      <div style="background-color:white;" v-if="true">
        <van-cell-group>
          <van-cell
            center
            border="false"
            title="设备名称"
            value="设备名称"
            title-class="textLeft"
            value-class="valueRight"
          />
          <van-cell
            center
            border="false"
            title="设备编号"
            value="设备编号"
            title-class="textLeft"
            value-class="valueRight"
          />
          <van-cell
            center
            border="false"
            title="MAC地址"
            v-bind:value="macAddress"
            title-class="textLeft"
            value-class="valueRight"
          />
          <van-cell
            center
            title="所属部门"
            value="仓储部"
            title-class="textLeft"
            value-class="valueRight"
          />
          <van-cell
            center
            title="当前用户"
            v-bind:value="loginUserName"
            title-class="textLeft"
            value-class="valueRight"
          />
        </van-cell-group>
      </div>
    </div>
    <div class="divLogoOutStyle">
      <van-button
        size="large"
        block="true"
        type="default"
        class="logout-btn-style"
        @click="confirmLogout"
      >退出登录</van-button>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { Dialog } from "vant";
import { mapActions } from "vuex";
import consts from "@/utils/consts";
import http from "@/utils/request.js";
import api from "@/utils/api";
import router from "@/router";
import Toast from "@/utils/toast";
import { NavBar } from "vant";
import { Cell, CellGroup } from "vant";
Vue.use(Cell);
Vue.use(CellGroup);
Vue.use(NavBar);

export default {
  data() {
    return {
      loginUserName: this.$store.getters.email,
      macAddress: ""
    };
  },
  mounted() {
    this.getMacAddress();
  },
  methods: {
    onClickLeft() {
      router.push({ path: "/navagation" });
    },
    ...mapActions(["logout"]),
    confirmLogout() {
      Dialog.confirm({
        title: "退出登录",
        message: "确认退出登录吗？"
      })
        .then(() => {
          // on confirm
          this.logout();
          // this.$store.commit("moveStoreArray1", {flag:3});
          // this.$store.commit("array1", {flag:3});
          // window.localStorage.clear();
          // this.$router.push({ path: "/login" });
        })
        .catch(() => {
          // on cancel
        });
    },
    getMacAddress() {
      this.macAddress = window.AndroidWebView.getMacAddress();
    }
  },
  created: {}
};
</script>

<style lang="scss" scoped>
.nav-bar {
  background-color: #1c356c;
  background-size: cover;
  height: 140px !important;
}
.mine-head-style {
  font-size: 30px;
  font-family: PingFangSC-Regular;
  font-weight: 400;
  color: rgba(255, 255, 255, 1);
  line-height: 42px;
  letter-spacing: 1px;
}
.van-nav-bar__left {
  margin-top: 11px;
}
.van-nav-bar__left {
  top: 0;
}
.van-cell__title {
  width: 30%;
  flex: none;
}
.setting-info-style {
  width: 100%;
}
.textLeft {
  text-align: left;
  margin-left: 10px;
  font-size: 22px;
}
.valueRight {
  text-align: right;
  margin-right: 40px;
  font-size: 22px;
}
.logout-btn-style {
  margin-top: 30px;
  margin-bottom: 22px;
  width: 92%;
  height: 56px;
  background: #2e71ff;
  border-radius: 50px;
  font-size: 22px;
  font-family: PingFangSC;
  font-weight: 400;
  color: rgba(255, 255, 255, 1);
  line-height: 45px;
  letter-spacing: 1px;
  align-self: flex-end;
}
.logout-outside-dive-style {
  width: 100%;
  height: 100%;
  display: flex;
  margin-bottom: 80px;
  justify-content: center;
  position: fixed;
  bottom: 220px;
  width: 100%;
  height: auto;
  margin: auto;
}
.nav-bar-title-style {
  font-size: 22px;
  text-align: center;
  font-family: PingFangSC-Regular;
  color: #fff;
  margin-right: 62px;
}

.nav-bar-style {
  /* width: 64px;
  height: 42px; */
  font-size: 30px;
  font-family: PingFangSC-Regular;
  font-weight: 400;
  color: rgba(71, 124, 236, 1);
  background: #2e71ff;
}

.divLogoOutStyle {
  width: 100%;
  height: 100%;
  display: flex;
  margin-bottom: 20px;
  justify-content: center;
  position: fixed;
  bottom: 10px;
  width: 100%;
  height: auto;
  margin: auto;
}
</style>

